<template>
	<view class="invite">
		<view class="title">选择添加方式</view>
		<button class="btn" open-type="share">
			<view class="text-1">链接分享添加</view>
			<image class="img-icon" :src="$IMAGE_BASE_URL + '/static/ic_arrow_link.png'" />
			<image class="img-bg" :src="$IMAGE_BASE_URL + '/static/bg_share_link.png'"/>
		</button>
		<button class="btn" @click="toInviteMember">
			<view class="text-2">手机号码邀请</view>
			<image class="img-icon" :src="$IMAGE_BASE_URL + '/static/ic_arrow_phone.png'" />
			<image class="img-bg" :src="$IMAGE_BASE_URL + '/static/bg_share_phone.png'"/>
		</button>
	</view>
</template>

<script>
	import StorageUtils from "@/utils/StorageUtils";
	
	export default {
		data() {
			return {

			};
		},
		onShareAppMessage(res) {
			console.log("res", res);
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log("onShareAppMessage", res.from, res.target);
			}
			const homeId = StorageUtils.get("homeId");
			return {
				title: '邀请好友', //转发标题
				path: `/pages/mine/inviteConfirm?homeId=${homeId}`, //转发路径
			}
		},
		methods: {
			toInviteMember() {
				uni.navigateTo({
					url:'/pages/mine/inviteMember'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	/* 去掉 button 的默认样式 */
	button {
		border: none;
		background-color: transparent;
		padding: 0;
		margin: 0;
		text-shadow: none;
		box-shadow: none;
		border-radius: 0;
		outline: none;
		text-align: left;
		font-size: inherit;
		color: inherit;
		cursor: default;
	}

	.invite {
		height: 100vh;
		padding: 0 42rpx;
		background-color: #ffffff;

		.title {
			font-family: SourceHanSansCN;
			font-size: 60rpx;
			color: #313131;
			margin-bottom: 90rpx;
			padding-top: 20rpx;
		}

		.btn{
			height: 180rpx;
			border-radius: 10rpx;
			margin-bottom: 40rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			
			.text-1 {
				position: relative;
				z-index: 9;
				font-family: SourceHanSansCN;
				font-size: 40rpx;
				font-weight: bold;
				color: #068400;
			}
			
			.text-2 {
				position: relative;
				z-index: 9;
				font-family: SourceHanSansCN;
				font-size: 40rpx;
				font-weight: bold;
				color: #007c3b;
			}

			.img-icon {
				position: relative;
				z-index: 9;
				width: 45rpx;
				height: 20rpx;
			}
			
			.img-bg {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				top: 0;
			}
		}
	}
</style>